Skip to content

release: publish Sidebar 0.29.0 with GenUI sidechat support - #1077

Merged
Menghuan1918 merged 112 commits into
mainfrom
dev
Nov 4, 2026
Merged

Menghuan1918 merged 112 commits into
mainfrom
dev

Conversation

@taekchef

Copy link
Copy Markdown
Collaborator

发布 Sidebar 0.29.0,为 GenUI 0.15.0 提供已结算侧边回复的可选渲染服务,动作和状态保留在对应子线程。

已通过 #1075 集成并保留原 #1033 的提交与作者署名,同时保留 0.28.2 的冷会话修复。dev 合入结果与通过 CI 的 cd1251b 候选树完全一致。

Sidebar 的 Linux 全量检查、Windows 全量检查和真实挂载冒烟均通过。GenUI 的真实 DSH rc.3 双插件验收已在 Node 22/24 通过,覆盖正常安装、两子线程隔离、四次动作的持久化回执和清理。会话使用官方本地回放,原 Windows Desktop 场景仍待人工复测。

本 PR 遵循 dev → main → tag 的现有发布流程;版本字段、公开服务版本和中英文说明均为 0.29.0。

wang-kaopu and others added 17 commits October 11, 2026 23:05
Windows 上 fs.rename 走 MoveFileExW(REPLACE_EXISTING):同一目标路径上的多个
rename 互斥,只让一个落地,其余被拒 EPERM(不是排队)。唯一 temp 名消除的是
源文件交叉,没消除目标路径互斥 —— 这正是「concurrent uploads to the same
target independent」这条契约没被兑现的原因。

实测(本机 Windows,真实 fs.rename 打到同一目标、barrier 启动让各方落在同一
瞬间、UV_THREADPOOL_SIZE=64 让它们真并行,各方均不重试):

  同时方数   每轮被拒方数   零被拒的轮数
  2          0–1            42/100
  8          2–5            0/50
  32         20–25          0/30

有界重试的档位(同一台机器):

  同时方数   limit=2        limit=5         limit=10
  8          28/50 轮失败   0/50            0/50
  32         50/50 轮失败   46/50 轮失败    0/50

- src/fs-operations.ts:新增 renameIntoPlace(),对 EPERM/EACCES/EBUSY 做有界
  重试(上限 10,setImmediate 让出事件循环),其余 errno 首次即抛。上限取自
  实测(见上表:32 方下 5 档不够、10 档干净)。JSDoc 改为如实描述:temp 名
  解决的是源文件交叉,rename 本身并不独立。
- tests/fs-operations.spec.ts:新增 bodiesThatMeet barrier,让并发方都到齐再
  一起放行(原写法「同时启动」证明不了重叠:实测两次 rename 的发起间隔中位数
  约 117μs,时间都花在写流上)。并发方数 2 → 8、用例跑 4 轮;断言一条未放宽。

验证(负对照,本机 Windows):
- 补丁不在(origin/main 原样):全量跑实测红在该用例,错误正是
  `EPERM: operation not permitted, rename ...`,栈顶 src/fs-operations.ts:107。
- 把 renameIntoPlace 换回裸 rename:该用例立刻红(1 failed)。
- 补上:29/29 绿、连跑 6 次稳定;typecheck 与 lint 干净。
- 全量:2463 passed / 5 failed;那 5 个失败与改动前逐字相同(plugin-meta 的
  tar CRLF 与 tasks-model 的中文 locale),均为本机环境既有、与本次改动无关。
…bmenu flip (#955)

layout.css opens @media (prefers-reduced-motion: reduce) at line 77 and never
closes it. 36fbc5a deleted the run of 61 lines that started with that brace and
ran to the end of the file (0 insertions, 61 deletions), and b011be1 added the
context-menu submenu rules back below the still-open block (60 insertions). The
file has been one brace short ever since: 13 '{' against 12 '}'.

Everything from line 78 on is therefore a descendant of the media query. The
only rules in that range are the media query's intended child — the center
column's 'transition: none' — and the six rules that consume the
data-dsh-sidebar-submenu attribute menu-flip.ts publishes on <body>: the flip
that keeps a nested submenu inside the viewport, and the visual tether (parent
row highlight, 4px gap, 4px hover corridor). In the default theme none of them
matched, so our "open with" submenu grew past the right edge of a right-docked
workbench; reduce-motion users were the only ones who ever got the flip (#955).

Restoring the brace puts all six back at top level. No rule text changes: the
result is byte-identical to the pre-regression revision 36fbc5a^ (7219 bytes).

tests/css-block-scope.spec.ts pins the property that hid this: menu-flip.spec.tsx
asserts with toContain, which matches selector text wherever it sits, so the
nesting stayed green in every released version from v0.24.1 through v0.26.1, and
on dev (0.27.0) where it still is. The new spec reads block structure instead:
every stylesheet under src/ has to close what it opens, and the six flip/tether
selectors have to open at depth 0. Run against the historical revisions, the spec is red on every
revision that shipped the nesting — v0.24.1 through v0.26.1 and dev — where it
reports "1 unclosed block(s)" and names the flip rules as nested. 36fbc5a is the
commit that lost both the brace and the rules, and it deleted menu-flip.ts with
them, so the spec cannot even load there; with that module stubbed back in, both
assertions fail on its CSS. On 36fbc5a^ and on this branch the spec passes.

Verified on this branch: pnpm exec vitest run tests/css-block-scope.spec.ts
tests/menu-flip.spec.tsx -> 11 passed; pnpm typecheck, pnpm lint clean.
…rewrite pass and streaming parse inside the GenUI row component
Preserve original contribution and reviewed assist merge; retain PR base dev.
pathUnderOf(base, target) answers "is target under base", so the
effectiveBase guard has to be called as (canonicalTop, base). It was
called as (base, canonicalTop), which asks the opposite question and
always fell back to the repository toplevel — every workspace-relative
path opened through the sidebar then resolved one level too high
(deliverable cards reported cannot read ... ENOENT).

Also adds the regression case the suite was missing: a workspace
registered at a plain SUBDIRECTORY of the repository (base != top).
Preserve the original provider PR #1033 commits and contributor attribution.
resolveAddressPath() re-spells an address path in the base's separator
style. Folding every separator run into one '\' also folded the UNC share
marker of a \\wsl.localhost\<distro>\... path, turning an absolute network
path into a drive-root-relative one. On Windows the host's requireAbsolute()
then path.resolve()d it onto the host process drive (C:\wsl.localhost\...),
so every file opened from a WSL workspace failed with ENOENT.

Keep exactly the two leading separators of a UNC path and fold only the
rest. Drive paths, POSIX bases and unknown bases are unchanged.

tests/worktree-address.spec.ts pins the UNC absolute, workspace-relative and
forward-slash spellings; the case fails on the previous source and passes
with the fix.
ponyololo and others added 12 commits October 28, 2026 20:20
Mermaid measures every label with SVGElement.getBBox() against a node
appended to document.body, so each measurement flushes the whole host
document's layout. Measured in the live DSH window (15,418 DOM nodes):
59-75 ms per measurement, versus 1 ms in an empty iframe document. One
diagram therefore took 1.5-7.3 s, and a 31-diagram markdown document kept
the renderer main thread blocked for >20 s - long enough for the desktop
shell's surface watchdog to kill the renderer, with tab restoration
turning it into a crash loop. CSS containment on the app root does not
help (59-62 ms); only an independent layout tree does.

Render diagrams inside a hidden sandboxed iframe instead: a self-contained
blob: document (mermaid UMD bundle + a small postMessage protocol, both
inlined by scripts/build-mermaid-frame-asset.mjs) renders each diagram;
the parent only sends/receives and sanitizes the SVG. Diagrams now take
30-104 ms each and 31 diagrams complete in ~5 s in the background, while
the client mermaid chunk shrinks from 7.04 MB to 3.69 MB (minified UMD
replaces the unminified inline bundle).

Also add a shared render queue: visible/near-viewport diagrams first, the
rest filled in on requestIdleCallback with 16 ms main-thread yields between
renders, so every diagram is still rendered (none degrades to a code
block). Fence-line-sized placeholder skeletons reserve height while a
diagram waits. No host-half route changes are needed.
Follow-up to the iframe isolation: after that fix a 31-diagram document
still felt janky while scrolling. The remaining cost was work competing
with the scroll gesture:
- background diagram renders kept running during scroll (each one injects
  an SVG, runs DOM passes and lays out);
- hidden native tabs kept warming diagrams (tab bodies are keepMounted);
- the inline-HTML and heading-anchor MutationObservers ran a full-document
  scan per mutation (measured 8-15 ms per pass, dozens of passes when a
  document swaps its diagrams in);
- initial near-viewport detection read one rect per diagram between DOM
  writes, forcing a layout per diagram;
- off-screen rendered SVGs still participated in layout and paint.

The queue now pauses background work for 350 ms after the last captured
scroll event, and only schedules renders whose preview is visible
(IntersectionObserver gate per preview; hidden tabs keep placeholders and
wake the queue when shown again, and unmounting a preview drops its queued
tasks). The two mutation passes coalesce bursts into one 80 ms pass.
Initial priorities come from one batched rect read before the swap writes.
.mermaidWrap gains content-visibility:auto + contain-intrinsic-size +
contain:layout paint style, so off-screen diagrams leave layout and paint.

Visible diagrams still render on demand, every diagram is still eventually
rendered, and nothing falls back to a code block.
A failed render used to show only a generic "Mermaid render failed" label
plus the fence source, with the actual reason hidden in the hover title —
which makes a bad fence hard to find. Print the first two lines of
mermaid's own message under the label (the full text stays on the title)
and cover it in the fallback spec.

This was triggered by a real document whose diagram used "A 与 B" instead
of mermaid's "A & B" multi-target syntax: the error strip now names the
parse error and the source block points at the broken lines.
…e the frame protocol

Review findings on #1040:

- A bad fence no longer poisons the document. `renderMermaidDiagram` used to
  treat every `renderInFrame` rejection as a frame failure, so a mermaid
  syntax error (a normal `mermaid-error` answer) was retried and then flipped
  `frameUnavailable` — every later diagram failed until the page reloaded.
  Frame answers are now classified: `MermaidDiagramError` is final for that
  one diagram (its block shows the message + source), while
  `MermaidFrameError` (load/handshake/timeout/protocol) gets the single retry
  and then the page-level fast-fail breaker.
- Both directions of postMessage are validated. Parent side binds
  `event.source` to the frame's `contentWindow` plus an opaque-origin
  allowlist and validates id/svg/message; the inlined frame script binds
  `event.source` to `window.parent` and validates id/code/theme/length before
  rendering.
- Visibility gating now flushes on return: the 80ms inline-HTML pass remembers
  a skipped pass and replays it on `visibilitychange`, and the preview handle
  also pauses/resumes on document visibility (not just IntersectionObserver).
- Tests: new `tests/mermaid-frame.spec.ts` covers the error classes
  (diagram error does not break later renders; transport retry; breaker after
  two failures) and the message validator (wrong window/origin, malformed
  payloads); the asset spec pins the frame-side sender/payload checks.
The merged editor mode rewrites the current tab's path, which remounts the viewer and drops a draft that lives only in that instance. Ask the same unsaved-edit guard the tab close uses; re-opening the current path and native-claimed files do not switch this tab and stay prompt-free.
refreshFile and the in-place file switch used the same three-line no-confirm fallback. Extract it once and keep the fallback semantics unchanged; the comment now says the switch reads the same dirty registry as the close guard, not that the fallback is identical.
The ci-windows lane failed in archive.spec.ts's afterEach with ENOTEMPTY after the test had passed. The same cleanup flaked on 2026-10-15; the existing 10x50 ms retry budget is too short on a loaded runner. Raise it to 30x100 ms; POSIX still succeeds on the first attempt.
dragonnahs and others added 29 commits November 4, 2026 16:55
…e switcher

A container workspace (a project directory that is not itself a repository)
can hold several independent repositories. Discovery and `git.status`
already report all of them; the panel listed them only in the
"more actions -> repository" submenu, so nothing on screen said the others
existed and the body silently rendered repositories[0].

Render one chip per discovered root above the Changes section, mark the
root the panel is pinned to, and switch through the existing chooseRepo so
reads, mutations and the commit graph follow the selection. A single
repository workspace renders no row; the menu entry stays.
Only a prompt body past the 1 MiB metadata cap is counted toward the concurrent image admission limit, so plain-text prompts are never rejected; exceeding the cap answers 413 too-large instead of a retryable 503. admitPromptContent failures now route on the host attachment code: oversized images are 413 too-large, storage faults are 500 sidechat-error, both keeping the host message.
The section was nested under the removed free-window chapter; it now sits after the archive routes as 6.2, drops the false claim that the image-remove control is the host Button, and points the connection-admission references at section 6.
…失败回退、注册契约与文档)

# Conflicts:
#	CHANGELOG.md
#	CHANGELOG_EN.md
… seed

A side thread opened while the parent was mid-turn could persist a child
session the host can never read again: SessionFormatError "delivery
throughSeq must precede its marker".

Root cause: when the parent has compacted, buildSidechatInheritance copies
the log around its last checkpoint with RENUMBERED seqs, but the inherited
session-log-deepseek/delivery-accepted watermark (throughSeq) is an
absolute seq. Left alone it keeps pointing at the parent's position and
can land at or after the marker's own new seq, which the v4 reader treats
as corrupt; the parent's includeDescendants export then fails with it.

The rebase now carries the watermark through the same map it applies to
every other seq citation, and drops the record when the watermark fell
inside the dropped span (there is no child-side equivalent). The verbatim
full-copy path is untouched — seqs are identity there, so nothing changes.

Tests: tests/sidechat-compaction-seed.spec.ts builds a compacted parent
carrying real delivery markers and asserts every surviving marker cites
the same earlier event the parent marked, while markers whose watermark
was trimmed away do not survive (red before the fix: throughSeq 15 for a
marker at seq 8).

Closes #1109
profile 自带的 @deepseek-ai/dsh-* 会覆盖宿主安装的同一批包(DSH 的 profile
解析先取 profile 前缀内的副本),本插件静态 import 的 dsh-subagent 因此绑到
混搭版本;混版缺导出时宿主只报 DesktopHostFatalError / required plugins did
not activate,看不到是哪个包缺了什么。

新增随包发布的 scripts/check-profile-host-tree.mjs:按 DSH 的 profile 解析
规则(只看 profile 前缀内的副本、上级 profiles/node_modules 不参与)判定
dsh-subagent 精确声明的 dsh-attachment peer。install.sh / install.ps1 装完
运行它,混版时打印两份版本号与修复命令并退出,不再提示重启。README 常见
问题、docs/host-contracts.md 与中英 CHANGELOG 同批记录;新增
tests/install-host-tree.spec.ts 真跑发布脚本钉住行为。
宿主原生页签条的关闭路径只有一个同步清理钩子(唯一的阻止方式是 throw,
会把异常抛给 replaceTab / 公共 close() 调用方),桌面 Cmd+Q 则完全在壳内
完成(before-quit → app.exitRequested),页面没有可取消事件;壳内也没有
will-prevent-unload 处理器。插件因此不伪造拦截,改为降低损失:

- 草稿变脏时按 1 s 节流把实时文档写入 localStorage(sessionId::path,
  单条 200k 字符 / 总计 600k / 最多 8 条 FIFO)
- 原生 registerCloseHandler('editor') 与 beforeunload 时立即 flush
- 重开同一文件提示恢复;保存、确认丢弃、确认刷新/换文件即删除备份

新增 src/client/editor-draft-backup.ts;docs/host-contracts.md §C 记录宿主
限制与将来的接法。测试:新增 editor-draft-backup.spec.tsx(8 例)+ guard
spec 2 例;去掉任一修复点后对应用例均转红。
- package.json / dsh.plugin.json / SIDEBAR_SERVICE_VERSION already at 0.30.0
- CHANGELOG: 未发布 → v0.30.0 (25 entries, bilingual)
- README / README_ZH: install commands target 0.30.0; Recent Updates trimmed to
  v0.30.0 / v0.29.0 / v0.28.2
- AGENTS + external-plugin-guide: baseline DSH 0.2.2-rc.1, current version v0.30.0
- plan record: docs/plans/2026-11-04-dsh-0.2.2-rc.1-adaptation.md
@Menghuan1918
Menghuan1918 merged commit 9285c06 into main Nov 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.